package net.xiduth.game.player;

import java.util.concurrent.ConcurrentHashMap;

import net.xiduth.Settings;

public class InterfaceManager {

	public static final int FIXED_WINDOW_ID = 548;
	public static final int RESIZABLE_WINDOW_ID = 746;
	public static final int CHAT_BOX_TAB = 13;
	public static final int FIXED_SCREEN_TAB_ID = 27;
	public static final int RESIZABLE_SCREEN_TAB_ID = 28;
	public static final int FIXED_INV_TAB_ID = 166;
	public static final int RESIZABLE_INV_TAB_ID = 108;
	public static int INTERFACE_ID = 1252;
	private Player player;

	private final ConcurrentHashMap<Integer, int[]> openedinterfaces = new ConcurrentHashMap<Integer, int[]>();

	private boolean resizableScreen;
	private int windowsPane;

	public InterfaceManager(Player player) {
		this.player = player;
	}

	public void sendTab(int tabId, int interfaceId) {
		player.getPackets().sendInterface(true,
				resizableScreen ? RESIZABLE_WINDOW_ID : FIXED_WINDOW_ID, tabId,
				interfaceId);
	}

	public void sendChatBoxInterface(int interfaceId) {
		player.getPackets().sendInterface(true, 752, CHAT_BOX_TAB, interfaceId);
	}

	public void closeChatBoxInterface() {
		player.getPackets().closeInterface(CHAT_BOX_TAB);
	}

	public void sendOverlay(int interfaceId, boolean fullScreen) {
		sendTab(resizableScreen ? fullScreen ? 1 : 11 : 0, interfaceId);
	}

	public void closeOverlay(boolean fullScreen) {
		player.getPackets().closeInterface(resizableScreen ? fullScreen ? 1 : 11 : 0);
	}

	public void sendInterface(int interfaceId) {
		player.getPackets()
				.sendInterface(
						false,
						resizableScreen ? RESIZABLE_WINDOW_ID : FIXED_WINDOW_ID,
						resizableScreen ? RESIZABLE_SCREEN_TAB_ID
								: FIXED_SCREEN_TAB_ID, interfaceId);
	}

	public void sendInventoryInterface(int childId) {
		player.getPackets().sendInterface(false,
				resizableScreen ? RESIZABLE_WINDOW_ID : FIXED_WINDOW_ID,
				resizableScreen ? RESIZABLE_INV_TAB_ID : FIXED_INV_TAB_ID,
				childId);
	}

	public final void sendInterfaces() {
		if (player.getDisplayMode() == 2 || player.getDisplayMode() == 3) {
			resizableScreen = true;
			sendFullScreenInterfaces();
		} else {
			resizableScreen = false;
			sendFixedInterfaces();
		}
		player.getSkills().sendInterfaces();
		player.getCombatDefinitions().sendUnlockAttackStylesButtons();
		player.getMusicsManager().unlockMusicPlayer();
		player.getEmotesManager().unlockEmotesBook();
		player.getInventory().unlockInventoryOptions();
		player.getPrayer().unlockPrayerBookButtons();
		if (player.getFamiliar() != null && player.isRunning())
			player.getFamiliar().unlock();
		player.getControlerManager().sendInterfaces();
	}

	public void replaceRealChatBoxInterface(int interfaceId) {
		player.getPackets().sendInterface(true, 752, 11, interfaceId);
	}

	public void closeReplacedRealChatBoxInterface() {
		player.getPackets().closeInterface(752, 11);
	}

	public void sendWindowPane() {
		player.getPackets().sendWindowsPane(resizableScreen ? 746 : 548, 0);
	}
	
	public static void sendCommands(Player player) {
		for (int i = 0; i < 75; i++) { 
			player.getPackets().sendIComponentText(960, i, "");
		}
		player.getInterfaceManager().sendInterface(960);
		player.getPackets().sendInterfaceText(960, 69, ""+Settings.SERVER_NAME +" Commands"); // Title
		player.getPackets().sendInterfaceText(960, 49, "General Commands");
		player.getPackets().sendInterfaceText(960, 56, "::train");
		player.getPackets().sendInterfaceText(960, 61, "::crystal");
		player.getPackets().sendInterfaceText(960, 62, "::home");
		player.getPackets().sendInterfaceText(960, 54, "::myhouse");
		player.getPackets().sendInterfaceText(960, 63, "::vote");
		player.getPackets().sendInterfaceText(960, 55, "::dung");
		player.getPackets().sendInterfaceText(960, 51, "::reward");
		player.getPackets().sendInterfaceText(960, 60, "::highscores");
		player.getPackets().sendInterfaceText(960, 58, "::website");
		player.getPackets().sendInterfaceText(960, 53, "Player Commands");
		player.getPackets().sendInterfaceText(960, 50, "::myinfo");
		player.getPackets().sendInterfaceText(960, 57, "::killstreak");
		player.getPackets().sendInterfaceText(960, 59, "::title");
		player.getPackets().sendHideIComponent(960, 52, true);

		player.getPackets().sendInterfaceText(960, 33, "Player Commands (cont.)");
		player.getPackets().sendInterfaceText(960, 39, "::xplock");
		player.getPackets().sendInterfaceText(960, 36, "::changepass");
		player.getPackets().sendInterfaceText(960, 44, "::players");
		player.getPackets().sendInterfaceText(960, 37, "::itemdb");
		player.getPackets().sendInterfaceText(960, 46, "::donate");
		player.getPackets().sendInterfaceText(960, 40, "::forum");
		player.getPackets().sendInterfaceText(960, 42, "::ticket");
		player.getPackets().sendInterfaceText(960, 34, "::i4gotmypin");
		player.getPackets().sendInterfaceText(960, 35, "::rfd");
		player.getPackets().sendInterfaceText(960, 38, "::aw");
		player.getPackets().sendInterfaceText(960, 43, "::livid");
		player.getPackets().sendInterfaceText(960, 47, "::lfm");
		player.getPackets().sendInterfaceText(960, 45, "::suggest");
		player.getPackets().sendHideIComponent(960, 41, true);

		player.getPackets().sendHideIComponent(960, 70, true);
		player.getPackets().sendHideIComponent(960, 71, true);
		return;
	}

	public void sendFullScreenInterfaces() {
		player.getPackets().sendWindowsPane(746, 0);
		sendTab(21, 752);
		sendTab(22, 751);
		sendTab(15, 745);
		sendTab(25, 754);
		sendTab(195, 748);
		sendTab(196, 749);
		sendTab(197, 750);
		sendTab(198, 747);
		player.getPackets().sendInterface(true, 752, 9, 137);
		if (player.getSpins() == 0) {
			player.getPackets().closeInterface(
					player.getInterfaceManager().hasRezizableScreen() ? 11 : 0);
		} else {
			player.getInterfaceManager().sendTab(
					player.getInterfaceManager().hasRezizableScreen() ? 11 : 0,
					1252);
			// player.getInterfaceManager().sendOverlay(1252, true);
		}
		sendCombatStyles();
		sendPlayerSupport();
		sendSkills();
		sendTab(114, 190);
		sendInventory();
		sendEquipment();
		sendPrayerBook();
		sendMagicBook();
		sendTab(120, 550); // friend list
		sendTab(121, 1109); // 551 ignore now friendchat
		sendTab(122, 1110); // 589 old clan chat now new clan chat
		sendSettings();
		sendEmotes();
		sendTab(125, 187); // music
		sendTab(126, 34); // notes
		sendTab(129, 182); // logout*/ 182 interface 1255 new one
		sendSquealOfFortune();
	}

	public void sendFixedInterfaces() {
		player.getPackets().sendWindowsPane(548, 0);
		sendTab(161, 752);
		sendTab(37, 751);
		sendTab(23, 745);
		sendTab(25, 754);
		sendTab(155, 747);
		sendTab(151, 748);
		sendTab(152, 749);
		sendTab(153, 750);
		player.getPackets().sendInterface(true, 752, 9, 137);
		player.getPackets().sendInterface(true, 548, 9, 167);
		if (player.getSpins() == 0) {
			player.getPackets().closeInterface(
					player.getInterfaceManager().hasRezizableScreen() ? 11 : 0);
		} else {
			player.getInterfaceManager().sendTab(
					player.getInterfaceManager().hasRezizableScreen() ? 11 : 0,
					1252);
			// player.getInterfaceManager().sendOverlay(1252, true);
		}
		sendMagicBook();
		sendPrayerBook();
		sendEquipment();
		sendInventory();
		sendTab(174, 190);
		sendTab(181, 1109);// 551 ignore now friendchat
		sendTab(182, 1110);// 589 old clan chat now new clan chat
		sendTab(180, 550);// friend list
		sendTab(185, 187);// music
		sendTab(186, 34); // notes
		sendTab(189, 182);
		sendSkills();
		sendEmotes();
		sendSettings();
		sendPlayerSupport();
		sendCombatStyles();
		sendSquealOfFortune();
	}
	public void clanRequestInterface(){
		player.getInterfaceManager().sendInterface(1090);
		//player.getPackets().sendIComponentText(1093, 52, player.getDisplayName()); 
		//player.getPackets().sendIComponentText(1093, 56, "" +player.getSkills().getTotalLevel(player));
		//crashes client if opened with cid 52 or 56
	}
	public void clanMates(){
		player.getInterfaceManager().sendInterface(1096);
		player.getPackets().hideComponent(1096, 83, false);
		player.getPackets().hideComponent(1096, 110, false);
		player.getPackets().hideComponent(1096, 84, true);
		player.getPackets().hideComponent(1096, 117, true);
		player.getPackets().hideComponent(1096, 85, true);
		player.getPackets().hideComponent(1096, 385, true);
		player.getPackets().sendRunScript(5136, 1);
		player.getPackets().hideComponent(1096, 202, false);
		player.getPackets().hideComponent(1096, 203, false);
		player.getPackets().hideComponent(1096, 217, false);
		player.getPackets().hideComponent(1096, 218, false);
		player.getPackets().sendIComponentSettings(1096, 240, 0, 144, 2);
		player.getPackets().sendIComponentSettings(1096, 290, 0, 200, 2);
		player.getPackets().sendIComponentSettings(1096, 41, 0, 500, 2);
		player.getPackets().sendIComponentSettings(1096, 276, 0, 125, 2);
		player.getPackets().sendIComponentSettings(1096, 262, 0, 500, 2);
	}
	public void clanPermissions(){
		player.getInterfaceManager().sendInterface(1096);
		player.getPackets().hideComponent(1096, 83, true);
		player.getPackets().hideComponent(1096, 110, true);
		player.getPackets().hideComponent(1096, 84, true);
		player.getPackets().hideComponent(1096, 117, true);
		player.getPackets().hideComponent(1096, 85, false);
		player.getPackets().hideComponent(1096, 385, false);
	}
	public void clanSettings(){
		player.getInterfaceManager().sendInterface(1096);
		player.getPackets().hideComponent(1096, 83, true);
		player.getPackets().hideComponent(1096, 110, true);
		player.getPackets().hideComponent(1096, 84, false);
		player.getPackets().hideComponent(1096, 117, false);
		player.getPackets().hideComponent(1096, 85, true);
		player.getPackets().hideComponent(1096, 385, true);
		
		
	}
	public void clanDetails(){
		player.getInterfaceManager().sendInterface(1107);
		player.getPackets().sendIComponentText(1107, 155, "" + player.getDisplayName());
		player.getPackets().hideComponent(1107, 139, true);
		player.getPackets().hideComponent(1107, 90, true);
		player.getPackets().hideComponent(1107, 60, true);
	}
	
	public void sendInvasionShop() {
		player.getInterfaceManager().sendInterface(267);
			player.getPackets().sendIComponentText(267, 93, "Dark Invasion Rewards (Items will be banked)");
			player.getPackets().sendHideIComponent(267, 101, true);
			player.getPackets().sendIComponentText(267, 105, "You have: " + player.getPlayerData().getInvasionPoints() + " points.");
			player.getPackets().sendHideIComponent(267, 104, true);
		/*
	    OPTION NAMES
		*/
			player.getPackets().sendIComponentText(267, 10, "Attack Xp");
			player.getPackets().sendIComponentText(267, 11, "Strength Xp");
			player.getPackets().sendIComponentText(267, 12, "Defence Xp");
			player.getPackets().sendIComponentText(267, 13, "Range Xp");
			player.getPackets().sendIComponentText(267, 14, "Magic Xp");
			player.getPackets().sendIComponentText(267, 15, "Const. Xp");
			player.getPackets().sendIComponentText(267, 16, "Prayer Xp");
			player.getPackets().sendIComponentText(267, 32, "Herbs");
			player.getPackets().sendIComponentText(267, 47, "Ores");
			player.getPackets().sendIComponentText(267, 33, "Seeds");
			player.getPackets().sendIComponentText(267, 28, "Void Knight Mace");
			player.getPackets().sendIComponentText(267, 29, "Void Knight Top");
			player.getPackets().sendIComponentText(267, 30, "Void Knight Bottom");
			player.getPackets().sendIComponentText(267, 31, "Void Knight Gloves");
			player.getPackets().sendIComponentText(267, 63, "Void Mage Helm");
			player.getPackets().sendIComponentText(267, 64, "Void Ranger Helm");
			player.getPackets().sendIComponentText(267, 65, "Void Melee Helm");
			player.getPackets().sendIComponentText(267, 66, "Void Commendations");
			
		/*
            ATTACK XP
		*/
			player.getPackets().sendIComponentText(267, 34, "1X");
			player.getPackets().sendIComponentText(267, 49, "5X");
			player.getPackets().sendIComponentText(267, 56, "10X");
		/*
             STRENGTH XP
		*/
			player.getPackets().sendIComponentText(267, 35, "1X");
			player.getPackets().sendIComponentText(267, 50, "5X");
			player.getPackets().sendIComponentText(267, 57, "10X");
		/*
             DEFENCE XP
		*/
			player.getPackets().sendIComponentText(267, 36, "1X");
			player.getPackets().sendIComponentText(267, 51, "5X");
			player.getPackets().sendIComponentText(267, 58, "10X");
		
		/*
              RANGE XP
		*/
			player.getPackets().sendIComponentText(267, 37, "1X");
			player.getPackets().sendIComponentText(267, 52, "5X");
			player.getPackets().sendIComponentText(267, 59, "10X");
		
		/*
              MAGIC XP
		*/
			player.getPackets().sendIComponentText(267, 38, "1X");
			player.getPackets().sendIComponentText(267, 53, "5X");
			player.getPackets().sendIComponentText(267, 60, "10X");
		
		/*
            HITPOINTS XP
		*/
			player.getPackets().sendIComponentText(267, 39, "1X");
			player.getPackets().sendIComponentText(267, 54, "5X");
			player.getPackets().sendIComponentText(267, 61, "10X");
		/*
             PRAYER XP
		*/
			player.getPackets().sendIComponentText(267, 40, "1X");
			player.getPackets().sendIComponentText(267, 55, "5X");
			player.getPackets().sendIComponentText(267, 62, "10X");
		/*
	       HERB
		*/
			player.getPackets().sendIComponentText(267, 45, "Buy");
		/*
		ORE
		*/
			player.getPackets().sendIComponentText(267, 46, "Buy");
		/*
	       SEEDS
		*/
			player.getPackets().sendIComponentText(267, 48, "Buy");
		/*
	       VOID
		*/
			player.getPackets().sendIComponentText(267, 41, "Buy(100)");//Void Knight Mace
			player.getPackets().sendIComponentText(267, 42, "Buy(100)");//Void Knight Top
			player.getPackets().sendIComponentText(267, 43, "Buy(100)");//Void Knight Robe
			player.getPackets().sendIComponentText(267, 44, "Buy(100)");//Void Knight Gloves
			player.getPackets().sendIComponentText(267, 67, "Buy(100)");//Void Mage Helm
			player.getPackets().sendIComponentText(267, 68, "Buy(100)");//Void Range Helm
			player.getPackets().sendIComponentText(267, 69, "Buy(100)");//Void Melee Helm
			player.getPackets().sendIComponentText(267, 70, "Buy");//Void Commendations
		/*
	   CHARMS NAME		
	        */
			player.getPackets().sendIComponentText(267, 71, "Not Available");
			player.getPackets().sendIComponentText(267, 72, "Not Available");
			player.getPackets().sendIComponentText(267, 73, "Not Available");
			player.getPackets().sendIComponentText(267, 74, "Not Available");
	}
	public void sendTrollShop() {
		player.getInterfaceManager().sendInterface(1011);
			player.getPackets().sendIComponentText(1011, 56, "Troll Invasion Rewards");
			player.getPackets().sendIComponentText(1011, 61, "	Points: <col=ff0000>"+player.getTrollPoints()+"");
			player.getPackets().sendIComponentText(1011, 29, "Crystal key (5 pts.)");
			player.getPackets().sendIComponentText(1011, 31, "Whistle (20 pts.)");
			player.getPackets().sendHideIComponent(1011, 62, true);
	}
	
	
	public void sendWelcome() {
	player.getInterfaceManager().sendInterface(1225);
	player.getPackets().sendIComponentText(1225, 21, 
			"We would like to notify you that if your gameplay screen is black upon login, just give it some time to load the cache entirely.");
	player.getPackets().sendIComponentText(1225, 22, 
			"Jatix has all the shops you need! We hope you enjoy your stay! Are you ready to start your journey?");
}
	
	public void sendNewDungShop() {
		player.getInterfaceManager().sendInterface(940);
				player.getPackets().sendIComponentText(940, 31, ""+player.getDungTokens()+"");
	}
	
	
	public void sendDungShop() {
		player.getInterfaceManager().sendInterface(825);
		        player.getPackets().sendIComponentText(825, 95,  "Chaotic rapier");
		        player.getPackets().sendIComponentText(825, 96,  "30K");
		        player.getPackets().sendIComponentText(825, 99,  "Chaotic longsword");
		        player.getPackets().sendIComponentText(825, 100,  "30K");
		        player.getPackets().sendIComponentText(825, 103,  "Chaotic maul");
		        player.getPackets().sendIComponentText(825, 104,  "30K");
		        player.getPackets().sendIComponentText(825, 107,  "Chaotic staff");
		        player.getPackets().sendIComponentText(825, 108,  "30K");
		        player.getPackets().sendIComponentText(825, 111,  "Chaotic crossbow");
		        player.getPackets().sendIComponentText(825, 112,  "30K");
		        player.getPackets().sendIComponentText(825, 115,  "Chaotic & Eagle-eye shield");
		        player.getPackets().sendIComponentText(825, 116,  "30K");
		        player.getPackets().sendIComponentText(825, 119,  "Arcane stream necklace");
		        player.getPackets().sendIComponentText(825, 120,  "15K");
		        player.getPackets().sendIComponentText(825, 123,  "Ring of vigour");
		        player.getPackets().sendIComponentText(825, 124,  "15K");
		        player.getPackets().sendIComponentText(825, 127,  "Dung. EXP"); 
		        player.getPackets().sendIComponentText(825, 128,  "3K");
		        player.getPackets().sendIComponentText(825, 131,  "Stardust");
		        player.getPackets().sendIComponentText(825, 132,  "0.3K");
		        player.getPackets().sendIComponentText(825, 134,  "Dragon claws");
		        player.getPackets().sendIComponentText(825, 135,  "30K");
		        player.getPackets().sendIComponentText(825, 138,  "Extreme Dragon claws");
		        player.getPackets().sendIComponentText(825, 139,  "100K");
		        player.getPackets().sendIComponentText(825, 54,  "Your Tokens:");
		        player.getPackets().sendIComponentText(825, 55,  ""+player.getDungTokens()+"");
		        player.getPackets().sendIComponentText(825, 66,  "");
		        player.getPackets().sendIComponentText(825, 67,  "Welcome to the token store. Here, you can buy rewards with your dungeoneering tokens.");
		    }
	
	public void updateGWDKC() {
		player.getPackets().closeInterface(
				player.getInterfaceManager().hasRezizableScreen() ? 34 : 8);
		player.getInterfaceManager().sendTab(
				player.getInterfaceManager().hasRezizableScreen() ? 34 : 8, 601);
				player.getPackets().sendIComponentText(601, 8, ""+player.getArmadylKC());
				player.getPackets().sendIComponentText(601, 9, ""+player.getBandos());
				player.getPackets().sendIComponentText(601, 10, ""+player.getSaradominKC());
				player.getPackets().sendIComponentText(601, 11, ""+player.getZamorakKC());
	}
	
	public void sendDTRewards() {
		player.getInterfaceManager().sendInterface(940);
		player.getPackets().sendIComponentText(940, 64,
				"Test");
		    }

	public void sendXPPopup() {
		sendTab(resizableScreen ? 38 : 10, 1213); // xp
	}
	

	public void sendXPDisplay() {
		sendXPDisplay(1215); // xp counter
	}

	public void sendXPDisplay(int interfaceId) {
		sendTab(resizableScreen ? 27 : 29, interfaceId); // xp counter
	}

	public void closeXPPopup() {
		player.getPackets().closeInterface(resizableScreen ? 38 : 10);
	}

	public void closeXPDisplay() {
		player.getPackets().closeInterface(resizableScreen ? 27 : 29);
	}

	public void sendEquipment() {
		sendTab(resizableScreen ? 116 : 176, 387);
	}

	public void closeInterface(int one, int two) {
		player.getPackets().closeInterface(resizableScreen ? two : one);
	}

	public void closeEquipment() {
		player.getPackets().closeInterface(resizableScreen ? 116 : 176);
	}

	public void sendInventory() {
		sendTab(resizableScreen ? 115 : 175, Inventory.INVENTORY_INTERFACE);
	}

	public void closeInventory() {
		player.getPackets().closeInterface(resizableScreen ? 115 : 175);
	}

	public void closeSkills() {
		player.getPackets().closeInterface(resizableScreen ? 113 : 173);
	}

	public void closeCombatStyles() {
		player.getPackets().closeInterface(resizableScreen ? 111 : 171);
	}

	public void closePlayerSupport() {
		player.getPackets().closeInterface(resizableScreen ? 112 : 205);
	}

	public void sendCombatStyles() {
		sendTab(resizableScreen ? 111 : 171, 884);
	}

	public void sendCompletionistCape() {
		player.getInterfaceManager().sendInterface(1245);
		player.getPackets().sendIComponentText(1245, 330,
				"Trimmed Completionist Cape");
		player.getPackets().sendIComponentText(1245, 13,
				"<u>Untrimmed Completionist Cape Requirements</u>");
		player.getPackets().sendIComponentText(1245, 14, "");
		player.getPackets().sendIComponentText(1245, 15,
				"You Need To Have Completed Fight Caves");
		player.getPackets().sendIComponentText(1245, 16,
				"You Need To Have Been Victorious In Fight Pits");
		player.getPackets().sendIComponentText(1245, 17,
				"You Need To Have Defeated 100 Dominion Tower Bosses");
		player.getPackets().sendIComponentText(1245, 18, "");
		player.getPackets().sendIComponentText(1245, 19, "");
		player.getPackets().sendIComponentText(1245, 20, "");
		player.getPackets().sendIComponentText(1245, 21, "");
		player.getPackets().sendIComponentText(1245, 22, "");
		player.getPackets().sendIComponentText(1245, 23, "");
	}

	public void sendTrimmedCompletionistCape() {
		player.getInterfaceManager().sendInterface(1245);
		player.getPackets().sendIComponentText(1245, 330,
				"Untrimmed Completionist Cape");
		player.getPackets().sendIComponentText(1245, 13,
				"<u>Trimmed Completionist Cape Requirements</u>");
		player.getPackets().sendIComponentText(1245, 14, "");
		player.getPackets().sendIComponentText(1245, 15,
				"You Need To Have Completed Fight Caves");
		player.getPackets().sendIComponentText(1245, 16,
				"You Need To Have Completed Fight Kiln");
		player.getPackets().sendIComponentText(1245, 17,
				"You Need To Have Defeated 250 Dominion Tower Bosses");
		player.getPackets().sendIComponentText(1245, 18,
				"You Need To Have Slain The Queen Black Dragon");
		player.getPackets().sendIComponentText(1245, 19,
				"You Need To Have Been Victorious In Fight Pits");
		player.getPackets().sendIComponentText(1245, 20, "");
		player.getPackets().sendIComponentText(1245, 21, "");
		player.getPackets().sendIComponentText(1245, 22, "");
		player.getPackets().sendIComponentText(1245, 23, "");
	}

	public void sendPlayerSupport() {
		sendTab(resizableScreen ? 112 : 172, 1019);
		player.getPackets().sendIComponentText(1019, 3, "Player Support");
		player.getPackets().sendIComponentText(1019, 16, "Report Bug");
		player.getPackets().sendIComponentText(1019, 11, "");
		player.getPackets().sendIComponentText(1019, 18, "Submit Ticket");
		player.getPackets().sendIComponentText(1019, 0,
				"Report any ingame bugs and glitches that you find. ");
		player.getPackets().sendIComponentText(1019, 8,
				"Submit a request ticket to online staff members. ");
	}

	public void sendQuest() {
		sendTab(resizableScreen ? 114 : 174, 190);
	}

	public void sendSkills() {
		sendTab(resizableScreen ? 113 : 173, 320);
	}

	public void sendSettings() {
		sendSettings(261);
	}

	public void closeSettings() {
		player.getPackets().closeInterface(resizableScreen ? 123 : 183);
	}

	public void sendSettings(int interfaceId) {
		sendTab(resizableScreen ? 123 : 183, interfaceId);
	}

	public void sendPrayerBook() {
		sendTab(resizableScreen ? 117 : 177, 271);
	}

	public void closePrayerBook() {
		player.getPackets().closeInterface(resizableScreen ? 117 : 177);
	}

	public void closeQuest() {
		player.getPackets().closeInterface(resizableScreen ? 114 : 174);
	}

	public void sendMagicBook() {
		sendTab(resizableScreen ? 118 : 178, player.getCombatDefinitions()
				.getSpellBook());
	}

	public void closeMagicBook() {
		player.getPackets().closeInterface(resizableScreen ? 118 : 178);
	}

	public void sendEmotes() {
		sendTab(resizableScreen ? 124 : 184, 590);
	}

	public void closeEmotes() {
		player.getPackets().closeInterface(resizableScreen ? 124 : 184);
	}

	public boolean addInterface(int windowId, int tabId, int childId) {
		if (openedinterfaces.containsKey(tabId))
			player.getPackets().closeInterface(tabId);
		openedinterfaces.put(tabId, new int[] { childId, windowId });
		return openedinterfaces.get(tabId)[0] == childId;
	}

	public boolean containsInterface(int tabId, int childId) {
		if (childId == windowsPane)
			return true;
		if (!openedinterfaces.containsKey(tabId))
			return false;
		return openedinterfaces.get(tabId)[0] == childId;
	}

	public int getTabWindow(int tabId) {
		if (!openedinterfaces.containsKey(tabId))
			return FIXED_WINDOW_ID;
		return openedinterfaces.get(tabId)[1];
	}

	public boolean containsInterface(int childId) {
		if (childId == windowsPane)
			return true;
		for (int[] value : openedinterfaces.values())
			if (value[0] == childId)
				return true;
		return false;
	}

	public boolean containsTab(int tabId) {
		return openedinterfaces.containsKey(tabId);
	}

	public void removeAll() {
		openedinterfaces.clear();
	}

	public boolean containsScreenInter() {
		return containsTab(resizableScreen ? RESIZABLE_SCREEN_TAB_ID
				: FIXED_SCREEN_TAB_ID);
	}

	public void closeScreenInterface() {
		player.getPackets()
				.closeInterface(
						resizableScreen ? RESIZABLE_SCREEN_TAB_ID
								: FIXED_SCREEN_TAB_ID);
	}

	public boolean containsInventoryInter() {
		return containsTab(resizableScreen ? RESIZABLE_INV_TAB_ID
				: FIXED_INV_TAB_ID);
	}

	public void closeInventoryInterface() {
		player.getPackets().closeInterface(
				resizableScreen ? RESIZABLE_INV_TAB_ID : FIXED_INV_TAB_ID);
	}

	public boolean containsChatBoxInter() {
		return containsTab(CHAT_BOX_TAB);
	}

	public boolean removeTab(int tabId) {
		return openedinterfaces.remove(tabId) != null;
	}

	public boolean removeInterface(int tabId, int childId) {
		if (!openedinterfaces.containsKey(tabId))
			return false;
		if (openedinterfaces.get(tabId)[0] != childId)
			return false;
		return openedinterfaces.remove(tabId) != null;
	}

	public void sendFadingInterface(int backgroundInterface) {
		if (hasRezizableScreen())
			player.getPackets().sendInterface(true, RESIZABLE_WINDOW_ID, 12,
					backgroundInterface);
		else
			player.getPackets().sendInterface(true, FIXED_WINDOW_ID, 11,
					backgroundInterface);
	}

	public void closeFadingInterface() {
		if (hasRezizableScreen())
			player.getPackets().closeInterface(12);
		else
			player.getPackets().closeInterface(11);
	}

	public void sendScreenInterface(int backgroundInterface, int interfaceId) {
		player.getInterfaceManager().closeScreenInterface();

		if (hasRezizableScreen()) {
			player.getPackets().sendInterface(false, RESIZABLE_WINDOW_ID, 40,
					backgroundInterface);
			player.getPackets().sendInterface(false, RESIZABLE_WINDOW_ID, 41,
					interfaceId);
		} else {
			player.getPackets().sendInterface(false, FIXED_WINDOW_ID, 200,
					backgroundInterface);
			player.getPackets().sendInterface(false, FIXED_WINDOW_ID, 201,
					interfaceId);

		}

		player.setCloseInterfacesEvent(new Runnable() {
			@Override
			public void run() {
				if (hasRezizableScreen()) {
					player.getPackets().closeInterface(40);
					player.getPackets().closeInterface(41);
				} else {
					player.getPackets().closeInterface(200);
					player.getPackets().closeInterface(201);
				}
			}
		});
	}

	public boolean hasRezizableScreen() {
		return resizableScreen;
	}

	public void setWindowsPane(int windowsPane) {
		this.windowsPane = windowsPane;
	}

	public int getWindowsPane() {
		return windowsPane;
	}

	public void closeSqueal() {
		player.getPackets().closeInterface(resizableScreen ? 119 : 179);
	}

	public void gazeOrbOfOculus() {
		player.getPackets().sendWindowsPane(475, 0);
		player.getPackets().sendInterface(true, 475, 57, 751);
		player.getPackets().sendInterface(true, 475, 55, 752);
		player.setCloseInterfacesEvent(new Runnable() {

			@Override
			public void run() {
				player.getPackets().sendWindowsPane(
						player.getInterfaceManager().hasRezizableScreen() ? 746
								: 548, 0);
				player.getPackets().sendResetCamera();
			}

		});
	}

	/*
	 * returns lastGameTab
	 */
	public int openGameTab(int tabId) {
		player.getPackets().sendGlobalConfig(168, tabId);
		int lastTab = 4; // tabId
		// tab = tabId;
		return lastTab;
	}

	public void sendSquealOfFortune() {
		sendTab(resizableScreen ? 119 : 179, 1139);
		player.getPackets().sendGlobalConfig(823, 1);
	}
	
	public void sendNewVote() {
		int inter = 1174;
		player.getInterfaceManager().sendInterface(inter);
		player.getPackets().sendIComponentText(inter, 64, "Voting Rewards");
		player.getPackets().sendIComponentText(inter, 46, "You currently have: " + player.getVotePoints() + " vote points.");
		player.getPackets().sendIComponentText(inter, 69, "PvP package");
		player.getPackets().sendIComponentText(inter, 71, "VP:");
		player.getPackets().sendIComponentText(inter, 70, "1");
		player.getPackets().sendIComponentText(inter, 33, "Gear package");
		player.getPackets().sendIComponentText(inter, 35, "VP:");
		player.getPackets().sendIComponentText(inter, 34, "3");
		player.getPackets().sendIComponentText(inter, 27, "Ring of wealth");
		player.getPackets().sendIComponentText(inter, 29, "VP:");
		player.getPackets().sendIComponentText(inter, 28, "5");
		player.getPackets().sendIComponentText(inter, 21, "Magic whistle");
		player.getPackets().sendIComponentText(inter, 23, "VP:");
		player.getPackets().sendIComponentText(inter, 22, "1");
		player.getPackets().sendIComponentText(inter, 15, "Crystal keys");
		player.getPackets().sendIComponentText(inter, 17, "VP:");
		player.getPackets().sendIComponentText(inter, 16, "1");
		player.getPackets().sendIComponentText(inter, 9, "Dragon claws");
		player.getPackets().sendIComponentText(inter, 11, "VP:");
		player.getPackets().sendIComponentText(inter, 10, "8");
		player.getPackets().sendIComponentText(inter, 3, "Book of casts");
		player.getPackets().sendIComponentText(inter, 5, "VP:");
		player.getPackets().sendIComponentText(inter, 4, "10");
	}

	public void sendLucienOptions() {
		//TODO RE-DOING
		int maininter = 797;
		int title = 143;
		int desc = 12;
		int green = 24;
		int underground = 38;
		int legends = 52;
		player.getInterfaceManager().sendInterface(maininter);
		player.getPackets().sendIComponentText(maininter, title, "Raiding Areas");
		player.getPackets().sendIComponentText(maininter, desc, "Select an area you would like to visit.");
		player.getPackets().sendIComponentText(maininter, green, "Mudskipper");
		player.getPackets().sendIComponentText(maininter, underground, "Underground");
		player.getPackets().sendIComponentText(maininter, legends, "Legends");
	}
	
	public void sendXMI() {
		int inter = 1160;
		player.getInterfaceManager().sendInterface(inter);
		player.getPackets().sendIComponentText(inter, 75, "" + player.getDisplayName() + "'s Dashboard");
		player.getPackets().sendIComponentText(inter, 41, "1.");
		player.getPackets().sendIComponentText(inter, 44, "2.");
		player.getPackets().sendIComponentText(inter, 46, "3.");
		player.getPackets().sendIComponentText(inter, 48, "4.");
		player.getPackets().sendIComponentText(inter, 50, "5.");
		player.getPackets().sendIComponentText(inter, 52, "6.");
		player.getPackets().sendIComponentText(inter, 54, "7.");
		player.getPackets().sendIComponentText(inter, 56, "8.");
		player.getPackets().sendIComponentText(inter, 26, "Jatix's shops");
		player.getPackets().sendIComponentText(inter, 28, "Claim rewards");
		player.getPackets().sendIComponentText(inter, 30, "Manage shop");
		player.getPackets().sendIComponentText(inter, 32, "View shop");
		player.getPackets().sendIComponentText(inter, 34, "Transportation");
		player.getPackets().sendIComponentText(inter, 36, "Raiding");
		player.getPackets().sendIComponentText(inter, 39, "Highscores");
		player.getPackets().sendIComponentText(inter, 40, "Web links");
		player.getPackets().sendHideIComponent(267, 104, true);
		/* player.getDialogueManager().startDialogue("SimpleNPCMessage",
				Settings.ORACLE,
				"Hello, " + player.getDisplayName() + "." + " Do you need something?"); */
		
	}


}
